package tongkeyon.create.singleton;

/**
 * @Author: keyon <tongkeyon@163.com>
 * @Date: 2020/2/17 10:40
 * @Version 1.0
 */
//将锁的粒度降低也要保证并发的安全性，可以使用双重检查
public class Type5 {
    private  Type5(){

    }

    private static volatile Type5 ty;

    public static Type5 getInstance(){
        if (ty ==null){
            synchronized (Type5.class){
                if (ty ==null){
                    ty=new Type5();
                }
            }
        }
        return  ty;
    }
}
